package com.ecode.ecny.uitl;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @ClassName DateUtil
 * @Author mjlft
 * @Date 2021/8/12 23:24
 * @Version 1.0
 * @Description 日期时间工具类
 */
public final class DateTimeUtil {

    private final static String YYYYDDMM = "yyyyMMdd";
    private final static String HHMMSS = "HHmmss";
    private final static String YYYYDDMMHHMMSS = "yyyyMMddHHmmss";

    /**
     * 获取当前日期， yyyyDDmm
     * @return
     */
    public static String getCurrentDate(){
       return DateTimeFormatter.ofPattern(YYYYDDMM).format(LocalDate.now());
    }

    /**
     * 获取当前时间 HHMMss
     * @return
     */
    public static String getCurrentTime() {
        return DateTimeFormatter.ofPattern(HHMMSS).format(LocalDateTime.now());
    }


    /**
     * 获取当前日期时间 yyyyDDmmHHMMss
     * @return
     */
    public static String getCurrentDateTime() {
        return DateTimeFormatter.ofPattern(YYYYDDMMHHMMSS).format(LocalDateTime.now());
    }
}
